<?php
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');

// 读取跳转配置
$redirectConfig = [
    'redirect_url' => '',
    'redirect_delay' => 3,
    'enable_redirect' => false
];

if (file_exists('redirect_config.json')) {
    $configData = json_decode(file_get_contents('redirect_config.json'), true);
    if ($configData) {
        $redirectConfig = array_merge($redirectConfig, $configData);
        // 确保 enable_redirect 是布尔值
        $redirectConfig['enable_redirect'] = (bool)$redirectConfig['enable_redirect'];
    }
}

echo json_encode($redirectConfig);
?>